package com.cskaoyan.controller;

import com.cskaoyan.bean.CskaoyanmallTopic;
import com.cskaoyan.bean.vo.BaseRespVo;
import com.cskaoyan.bean.vo.WxTopicDetailVoZGY;
import com.cskaoyan.bean.vo.WxTopicListVoZGY;
import com.cskaoyan.service.WxTopicServiceZGY;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("wx/topic/")
public class WxTopicControllerZGY {


    @Autowired
    WxTopicServiceZGY service;


    /**
     * 列出所有的Topic
     */
    @GetMapping("list")
    public BaseRespVo listTopic(Integer page, Integer size){

        WxTopicListVoZGY topicVo = service.queryTopics(page, size);

        return BaseRespVo.success(topicVo);
    }

    /**
     * 取出topic的详情
     */
    @GetMapping("detail")
    public BaseRespVo getTopicDetail(Integer id){

        WxTopicDetailVoZGY topicVo = service.queryTopicDetail(id);

        return BaseRespVo.success(topicVo);
    }

    /**
     * 推荐相关的主题
     */
//    /wx/topic/related?id=264
    @GetMapping("related")
    public BaseRespVo getRelatedTopics(Integer id){

        List<CskaoyanmallTopic> topicVo = service.QueryRelatedTopics(id);

        return BaseRespVo.success(topicVo);
    }


}
